import React,{ useState } from 'react'
import { View,Text,StyleSheet,TouchableOpacity,Image } from 'react-native'
import "../../global"

const AnswerPage = (e) => {
    const {chooseAnswer,trueAnswer,answerKey} = e.route.params;
    const [isRight,setIsRight] = useState();
    // if(chooseAnswer == trueAnswer){
    //     setIsRight(true);
    // }else{
    //     setIsRight(false);
    // }
    return (
        <View style={{backgroundColor:'white',height:h}}>
            <View style={{
                display:'flex',
                flexDirection:'row',
                marginTop:pxtodpH(30),
                marginLeft:pxtodpW(120)
            }}>
                <View style={{
                    display:'flex',
                    flexDirection:'row'
                }}>
                    <Text style={{
                        fontSize:30
                    }}>正确答案：
                    <Text style={{
                        color:'green'
                    }}>{trueAnswer}</Text></Text>
                </View>
                <View style={{
                    display:'flex',
                    flexDirection:'row',
                    marginLeft:pxtodpW(50)
                }}>
                    <Text style={{
                        fontSize:30
                    }}>你的答案：
                    <Text style={{
                        color:'red'
                    }}>{chooseAnswer}</Text></Text>
                </View>
            </View>
            <View style={{
                display:'flex',
                flexDirection:'row',
                marginTop:pxtodpH(60),
                justifyContent:'center',
                borderBottomColor:'grey',
                borderBottomWidth:1,
                paddingBottom:pxtodpH(50)
            }}>
                <View>
                    <Text style={{
                        color:'pink',
                        fontSize:30,
                        marginLeft:pxtodpW(70)
                    }}>75%</Text>
                    <Text style={{
                        fontSize:30,
                        color:'grey'
                    }}>全站正确率</Text>
                </View>
                <View style={{marginLeft:pxtodpW(150)}}>
                    <Text style={{
                        color:'lightblue',
                        fontSize:30,
                        marginLeft:pxtodpW(40)
                    }}>C</Text>
                    <Text style={{
                        color:'grey',
                        fontSize:30
                    }}>易错项</Text>
                </View>
            </View>
            <Image
                source={{uri:answerKey}}
                style={{
                    width:w,
                    height:pxtodpH(190)
                }}
            />
            {chooseAnswer==trueAnswer?
                <View style={{
                    marginTop:pxtodpH(50),
                    marginLeft:pxtodpW(20)
                }}>
                    <Image
                        source={require('../../images/answerTrue.png')}
                        style={{width:pxtodpW(200),height:pxtodpW(200),marginLeft:pxtodpW(260)}}
                    />
                    <Text style={{
                    fontSize:40,
                    marginTop:pxtodpH(80)
                    }}>山不厌高，海不厌深，继续努力吧！</Text>
                </View>
                : 
                <View style={{
                    marginTop:pxtodpH(50),
                    marginLeft:pxtodpW(20)
                }}>
                    <Image
                        source={require('../../images/answerFalse.png')}
                        style={{width:pxtodpW(200),height:pxtodpW(200),marginLeft:pxtodpW(260)}}
                    />
                    <Text style={{
                    fontSize:40,
                    marginTop:pxtodpH(80)
                    }}>人非圣贤，孰能无过，继续努力吧！！</Text>
                </View>
            }
        </View>
    )
}

export default AnswerPage